package iface;

import java.security.SignatureException;

import common.SignedData;

public interface CAServiceIface {

	/**
	 * Return the public key encoding
	 * @return encoding of public key
	 */
	public byte[] getPublicKeyEncoding();

	/**
	 * 
	 * @param byteArrToSign- data to sign
	 * @return byte array representation of the signature
	 * @throws SignatureException
	 */
	public byte[] sign(byte[] byteArrToSign) throws SignatureException;
	
	/**
	 * Called by a new client. 
	 * @return A new unique temporary client ID
	 */
	public Integer getTemporaryId();
	
	/**
	 * Provide a user with commitments produced using his polynomial.
	 * @param coefficients - user's polynomial coefficients
	 * @param secret - the first coefficient
	 * @return an array of strings, each representing a commitment
	 */
	public String[] getCommitments(Integer[] coefficients, Integer secret);
	
	/**
	 * Provide a user with signed commitments produced using his polynomial.
	 * @param coefficients - user's polynomial coefficients
	 * @param secret - the first coefficient
	 * @return array of SignedData each encapsulating a byte array representing the signed
	 * (using CA's public key) commitment 
	 */
	public SignedData[] getSignedCommitments(Integer[] coefficients, Integer secret);
}